package cc.yiueil.model.vo;

public class ResultVO<T> {

    private String msg;

    private String code;

    private T data;

    public ResultVO(String msg, String code, T data) {
        this.msg = msg;
        this.code = code;
        this.data = data;
    }

    public static ResultVO<String> authSuccess(String data) {
        return new ResultVO<>("success", "200", data);
    }

    public static ResultVO<String> authFail(String msg) {
        return new ResultVO<>(msg, "401", "认证失败");
    }

    public static <T> ResultVO<T> success(T data) {
        return new ResultVO<>("success", "200", data);
    }

    public static <T> ResultVO<T> fail(String msg) {
        return new ResultVO<>(msg, "500", null);
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
